home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / graphics / dxlib50.zip / RESIZE.INC < prev    next >
Text File  |  1995-02-11  |  2KB  |  35 lines

  1. ;   This include file should be placed immediately after the .STARTUP
  2. ;statement.  The code resizes the memory block into which DOS loaded the
  3. ;program so that DOS memory will be freed for allocation by XLIB.  The
  4. ;code assumes that SS:SP points to the end of the program.  This will be
  5. ;the case under both MASM and TASM if FARSTACK is used as a modifier to
  6. ;the .MODEL statement.  This file is not necessary under MASM if LINK
  7. ;is used with the CPARM:1 parameter.
  8.  
  9.                MOV            AX,SP          ;SS:SP = end of program
  10.                SHR            AX,4
  11.                MOV            BX,SS
  12.                ADD            BX,AX
  13.                INC            BX             ;BX = first para. beyond program
  14.                MOV            AX,ES          ;ES:0000 = first para. of program
  15.                SUB            BX,AX          ;BX = program size in para.
  16.                MOV            AH,4AH         ;Function to resize memory block
  17.                INT            21H            ;Carry will be set if failure
  18.                JNC            RESIZED
  19.                PUSH           CS             ;Print error message
  20.                POP            DS
  21.                MOV            BX,0007H
  22.                MOV            SI,OFFSET RESIZEFAILMSG
  23.                MOV            AH,0EH
  24. RESIZEMSGLOOP: MOV            AL,[SI]
  25.                OR             AL,AL
  26.                JZ             RESIZESTOP
  27.                INT            10H
  28.                INC            SI
  29.                JMP            RESIZEMSGLOOP
  30. RESIZESTOP:    MOV            AX,4C01H      ;Terminate
  31.                INT            21H
  32. RESIZEFAILMSG:
  33.                DB "Error: DOS cannot resize program memory block.",13,10,0
  34. RESIZED:
  35.